<template>
	<transition name="slide-down">
		<!-- 菜单栏 -->
    <div class="title-wrapper" v-show="menuVisible">
      <div class="left">
        <span class="icon-back" @click="back"></span>
      </div>
      <div class="right">
        <div class="icon-wrapper">
          <span class="icon-shelf" @click="goBookShelf"></span>
        </div>
        <div class="icon-wrapper">
          <span class="icon-cart"></span>
        </div>
        <div class="icon-wrapper">
          <span class="icon-more"></span>
        </div>
      </div>
    </div>
  </transition>
</template>

<script>
// import { mapGetters } from 'vuex'
import { ebookMixin } from '../../utils/mixin'
export default {
	mixins: [ebookMixin],
	methods: {
		back() {
			// 返回上一级
			this.$router.go(-1)
		},
		goBookShelf() {
      this.$router.push('/store/shelf')
    },
	}
}
</script>

<style lang="scss" rel="stylesheet/scss" scoped>
	// @import '../assets/styles/global';
	// @import url('../assets/styles/global.scss');
	// $ratio: 375 / 10;

	// @function px2rem($px) {
  //   @return $px / $ratio + rem;
	// }

	// @mixin center {
	// 	display: flex;
	// 	justify-content: center;
	// 	align-items: center;
	// }

	@import "../../assets/styles/global.scss";
	
	.title-wrapper {
    position: absolute;
    top: 0;
    left: 0;
    z-index: 210;
    display: flex;
    width: 100%;
    height: px2rem(48);
    background: white;
    box-shadow: 0 px2rem(8) px2rem(8) rgba(0, 0, 0, .15);
		font-size: px2rem(20);
    .left {
      flex: 0 0 px2rem(60);
      @include center;
			// margin-left: px2rem(15);
    }
    .right {
      flex: 1;
      display: flex;
      justify-content: flex-end;
      .icon-wrapper {
        flex: 0 0 px2rem(40);
        @include center;
        .icon-shelf  {
          font-size: px2rem(22);
        }
				.icon-cart {
					font-size: px2rem(22);
				}
      }
    }
  }

	// 过渡动画
	.slide-down-enter, .slide-down-leave-to {
  transform: translate3d(0, -100%, 0)
	}
	.slide-down-enter-to, .slide-down-leave, .slide-up-enter-to, .slide-up-leave {
	  transform: translate3d(0, 0, 0)
	}
	.slide-down-enter-active, .slide-down-leave-active, .slide-up-enter-active, .slide-up-leave-active, .fade-enter-active, .fade-leave-active, .slide-right-enter-active, .slide-right-leave-active {
	  transition: all .3s linear;
	}
	.slide-up-enter, .slide-up-leave-to {
	  transform: translate3d(0, px2rem(138), 0)
	}
	.fade-enter, .fade-leave-to {
	  opacity: 0;
	}
	.fade-enter-to, .fade-leave {
	  opacity: 1;
	}
	.slide-right-enter, .slide-right-leave-to {
	  transform: translate3d(-100%, 0, 0);
	}
	// 过渡动画
</style>
